---
artifact: {{ .ModuleName }}/build-proxy-failover-artifact
from: {{ .Images.BASE_GOLANG_19_ALPINE }}
git:
- add: /{{ $.ModulePath }}modules/402-{{ $.ModuleName }}/images/{{ $.ImageName }}/
  to: /src
  includePaths:
  - '**/*.go'
  - '**/*.mod'
  - '**/*.sum'
  stageDependencies:
    install:
    - '**/*.go'
    - 'go.mod'
    - 'go.sum'
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
  - cd /src
  - GOPROXY={{ $.GOPROXY }} CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-extldflags "-static" -s -w' -o proxy-failover-controller main.go
  - chown -R 64535:64535 proxy-failover-controller
  - chmod 0700 proxy-failover-controller
---
artifact: {{ .ModuleName }}/nginx-static-artifact
fromImage: common/nginx-static
fromCacheVersion: 432
git:
- add: /{{ $.ModulePath }}modules/402-{{ $.ModuleName }}/images/{{ $.ImageName }}/conf/
  to: /opt/nginx-static/conf
  stageDependencies:
    install:
    - '**/*.tpl'
---
image: {{ .ModuleName }}/{{ .ImageName }}
fromImage: common/distroless
import:
- artifact: {{ .ModuleName }}/build-proxy-failover-artifact
  add: /src/proxy-failover-controller
  to: /proxy-failover-controller
  before: setup 
- artifact: {{ .ModuleName }}/nginx-static-artifact
  add: /opt/nginx-static
  before: setup
docker:
  ENTRYPOINT: ["/proxy-failover-controller"]
